package com.iddaa.web.resource;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.iddaa.core.service.AccountService;
import com.iddaa.web.util.Response;

@Component
@Scope("request")
@Path("/accounts")
@Produces(MediaType.APPLICATION_JSON)
public class AccountResource {

	@Autowired
	private AccountService accountService;

	@GET
	@Path("/login/{username}/{password}")
	@Consumes(MediaType.APPLICATION_JSON)
	public Response saveOrUpdate(@PathParam("username") String username, @PathParam("password") String password) {
		return new Response(accountService.authentication(username, password));
	}

	// @GET
	// @Path("/{id}")
	// public Response load(@PathParam("id") Long id) {
	// return new Response(accountService.findById(id));
	// }
	//
	// @GET
	// @Path("/all/")
	// public Response loadAll() {
	// return new Response(countryService.loadAll());
	// }
	//
	// @DELETE
	// @Path("/{id}")
	// public Response delete(@PathParam("id") Long id) {
	// countryService.deleteCountry(id);
	// return new Response(true);
	// }
	//
	// @POST
	// @Path("/save/")
	// @Consumes(MediaType.APPLICATION_JSON)
	// public Response saveOrUpdate(Country country) {
	// countryService.saveCountry(country);
	// return new Response(true);
	// }

}
